Skip to content

fix: reset timePassed when timer duration is changed in study timer#697

Open
akhilmodi29 wants to merge 1 commit into
Charushi06:mainfrom
akhilmodi29:fix/studyplan-timer-timepassed-not-reset
Open

fix: reset timePassed when timer duration is changed in study timer#697
akhilmodi29 wants to merge 1 commit into
Charushi06:mainfrom
akhilmodi29:fix/studyplan-timer-timepassed-not-reset

Conversation

@akhilmodi29
Copy link
Copy Markdown

Fixes #696

Problem
When a user changes the timer duration after pausing mid-session,
timePassed was never reset to 0. This caused:

  • Restarting timer after duration change uses stale timePassed
  • Timer shows wrong remaining time
  • Timer ends earlier than expected duration

Fix
Added timePassed = 0 inside the timerDurationInput change
handler so elapsed time is always reset when duration changes.
Also removed the timePassed === 0 condition since we now
always reset it on duration change.

Testing

  • Start timer for 25 mins, pause at 5 mins ✅
  • Change duration to 10 mins ✅
  • Restart timer — shows correct 10 mins remaining ✅
  • Normal timer flow still works correctly ✅

@akhilmodi29
Copy link
Copy Markdown
Author

@Charushi06 Please review this PR and add the required labels including gssoc:approved. This fixes the timer timePassed not reset bug in study timer.

Labels suggested:

  • level:intermediate
  • type:bug
  • quality:clean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Study Timer - timePassed not reset when duration is changed causing wrong remaining time

1 participant